package com.google.code.easyparking.metier;

import com.google.code.easyparking.controleur.ControleurCamera;

public class Camera implements  ICamera{
	
	public IAccesParking accesReferent;
	private ControleurCamera controleur = new ControleurCamera();
	
	public Camera(IAccesParking accesReferent) {
		this.accesReferent = accesReferent;
	}
	
	/**
	 * @throws FullParkingException 
	 * @throws VehiculeAlreadyInParkingException 
	 * 
	 */
	@Override
	public int vehiculeArrive() throws FullParkingException, VehiculeAlreadyInParkingException {
		IPlaceParking place = accesReferent.garerVehicule(VehiculeFactory.getInstance().getVehicule(controleur.getImmat(), controleur.getLongeur(), controleur.getHauteur()));
		
		return place.getNumeroPlace();
	}
	
	@Override
	public void vehiculeSortie() throws FullParkingException, VehiculeAlreadyInParkingException {
		 accesReferent.quitterParking(VehiculeFactory.getInstance().getVehicule(controleur.getImmat(), controleur.getLongeur(), controleur.getHauteur()));
	}
}
